package test;

import org.mortbay.jetty.Server;
import org.mortbay.jetty.servlet.ServletHolder;

public class ServletContextServer {
    public static void main(String[] args) throws Exception {  
        Server server = new Server(8080);  
  
//        ServletContextHandler context = new ServletContextHandler(ServletContextHandler.SESSIONS);  
//        context.setContextPath("/");  
//        server.setHandler(context);  
  
        // http://localhost:8080/hello  
        context.addServlet(new ServletHolder(new HelloServlet()), "/hello");  
        // http://localhost:8080/hello/kongxx  
        context.addServlet(new ServletHolder(new HelloServlet("Hello Kongxx!")), "/hello/kongxx");  
  
        // http://localhost:8080/goodbye  
        context.addServlet(new ServletHolder(new GoodbyeServlet()), "/goodbye");  
        // http://localhost:8080/goodbye/kongxx  
        context.addServlet(new ServletHolder(new GoodbyeServlet("Goodbye kongxx!")), "/goodbye/kongxx");  
          
        server.start();  
        server.join();  
    }  
}
